<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('添加供应商')"/>
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-MaterialVendor-add">
        <input id="materialId" name="materialId" type="hidden" th:value="${material.id}"/>
        <div class="form-group">
            <label class="col-sm-3 control-label">物料编码：</label>
            <div class="col-sm-8">
                <input class="form-control" id="code" name="code" type="text" th:field="*{material.code}" readonly>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">物料名称：</label>
            <div class="col-sm-8">
                <input class="form-control" id="name" name="name" type="text" th:field="*{material.name}" readonly>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">单价：</label>
            <div class="col-sm-8">
                <input class="form-control" id="unitPrice" name="unitPrice" type="text" required>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label is-required">供应商类型：</label>
            <div class="col-sm-8">
                <select id="type" name="type" class="form-control"
                        th:with="type=${@dict.getType('material_type')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">供应商状态：</label>
            <div class="col-sm-8">
                <select name="status" class="form-control"
                        th:with="type=${@dict.getType('sys_normal_disable')}">
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                            th:value="${dict.dictValue}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">供应商：</label>
            <div class="col-sm-8">
                <select id="vendorId" name="vendorId" class="form-control select2-multiple" required>
                    <option th:each="vendorId:${vendorList}" th:value="${vendorId.id}" th:text="${vendorId.code}+'-'+${vendorId.name}" ></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注：</label>
            <div class="col-sm-8">
                <textarea class="form-control" id="remark" name="remark"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>
<script type="text/javascript">
    var prefix = ctx + "system/material";

    function submitHandler() {
        if ($.validate.form()) {
            $.operate.save(prefix + "/addMaterialVendorSave", $('#form-MaterialVendor-add').serialize());
        }
    }
</script>
</body>
</html>
